package test;

import java.io.*;

public class test {
    public static void main(String[] args) throws IOException {
        long strat = System.currentTimeMillis();
        File src=new File("C:\\Users\\ch200\\Downloads\\激活资料");
        File dest=new File("D:\\idea全家桶激活");
        method(src,dest);
        long end = System.currentTimeMillis();
        System.out.println("复制完毕，耗时："+(end-strat)/1000.0+"s");



    }

    private static void method(File src, File dest) throws IOException {
        dest.mkdirs();
        File[]files=src.listFiles();
        for (File file:files){
            if (file.isFile()){
                FileInputStream fis=new FileInputStream(file);
                FileOutputStream fos=new FileOutputStream(new File(dest,file.getName()));
                byte[]bytes=new byte[1024];
                int len;
                while ((len=fis.read(bytes))!=-1){
                    fos.write(bytes,0,len);
                }
                fos.close();
                fis.close();
            }else{
                method(file,new File(dest,file.getName()));
            }
        }

    }

}
